package com.moli.iov.real.enums;

public enum OnlineTag {
    /**
     * 成功
     */
    ON_LINE("在线", true),
    /**
     * 错误
     */
    OFF_LINE("离线", false);

    private OnlineTag(String key, Boolean value) {
        this.k = key;
        this.v = value;
    }

    private String k;

    private Boolean v;

    public OnlineTag valueOf(Boolean value) {
        if(value){
            return ON_LINE;
        }else{
            return OFF_LINE;
        }
    }

    public static String getKey(Boolean value) {
        if(value==null){
            return OFF_LINE.getK();
        }
        for (OnlineTag c : OnlineTag.values()) {
            if (c.getV().equals(value) ) {
                return c.k;
            }
        }
        return null;
    }

    public String getK() {
        return k;
    }

    public Boolean getV() {
        return v;
    }

}
